Community 
						
						Function mapping in a pandas dataframe  
					
						
						by: mnalevanko, 9 years ago Last edited: 9 years ago  
					
					
					
						
Hello, 
after creating a pandas dataframe consisting of historical stock prices I am trying to add a new column that would include the volume for each day if the stock price went down from previous day or 0 otherwise.
My problem is that mapping a function doesn't return desired results. This is my code:
The script does create a new column, however the rows do not contain any numbers. What I see in each line is the following message:
<map object at 0x05567630>
Any idea what I do wrong? Thank you very much!
Mike
					
				
 
				
					  
					  
					  × You must be logged in to post. Please login register 
					   
						  
					    
					  
				
				
					
		
        
        
	
				
					
You need to convert to list:
df['Adjusted volume'] = list(map(adjustedVolume, df['Difference'], df['Volume'])) 
				
					
					
						
						
							-Harrison 9 years ago 
							
						
						
						
							Reply   	
											
												
											
						
					 
					
					
					
					  
					  
					  × You must be logged in to post. Please login register